package com.lemonsama.lesson4;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class DialogTest extends JFrame {

    public DialogTest() {
        this.setVisible(true);
        setSize(700, 500);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        //获取容器
        Container contentPane = this.getContentPane();
        //设置绝对布局
        contentPane.setLayout(null);
        JButton jButton = new JButton("点击弹出一个对话框");
        jButton.setBounds(30, 30, 200, 50);
        jButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new MyDialog();
            }
        });
        contentPane.add(jButton);
    }

    public static void main(String[] args) {
        new DialogTest();
    }
}
